<template>
	<view class="wrapForm pzForm">
		<view class="bgLine"></view>
		<view class="wrapFormBody pL15 pR15 pT15">
			<u-form :label-width="300" class="xf-wrap-form" ref="dataForm" :rules="rules" :model="formData">

				<u-form-item :required="true" :label-style="{'font-size':'36rpx'}" :border-bottom="false" :label-position="'top'"
					label="申诉理由" prop="complaintsReason">
					<u-input :custom-style="{background:'#F8F8F8',borderRadius:'20rpx',padding:'30rpx 30rpx !important'}"
						:placeholderStyle="'margin-left:24rpx;color:#8d8d8d'" class="textPz" type="textarea"
						placeholder="请详细描述您需要补充的内容" v-model="formData.complaintsReason" />
				</u-form-item>
				<u-form-item :label-style="{'font-size':'36rpx'}" :border-bottom="false" :label-position="'top'"
					label="上传凭证" prop="complaintsPicture">
					<xfUploadImg  v-model="formData.complaintsPicture" :limit="9" />
				</u-form-item>
			</u-form>
		</view>
		<view class="flex jst-center bottomW">
			<view class="pointer rightNowPay u-f font15 t-center" @click="submitPz">
				确定
			</view>
		</view>
	</view>
</template>

<script>
	import {submitSsForm} from  "@/api/userInterface/user.js"
	import {
		getLocalAddress
	} from "@/libs/map.js"
	export default {
		data() {
			return {
				formData: {
					ordersId: "",
					complaintsReason: "",
					complaintsPicture: ''
				},
				type:1,

				rules:{
					complaintsReason: [{
						required: true,
						message: '请输入备注',
						trigger: ['change', 'blur'],
					}],
				}
			}
		},
		 onLoad(e) {
			this.formData.ordersId=e.id;
			console.log(this.formData)
		},
		onReady() {
			this.$refs.dataForm.setRules(this.rules);
		},
		methods: {
		
			submitPz() {
				this.$refs.dataForm.validate(valid => {
					if (valid) {
						let data=this.xf.deepClone(this.formData)
						if(data.complaintsPicture.length>0){
							data.complaintsPicture=data.complaintsPicture.map(obj => obj.url).join(',')
						}
						
						submitSsForm(data).then(res=>{
							this.xf.onlineUtils.toast(res.message);
							this.formData.complaintsReason="";
							this.formData.complaintsPicture="";
							setTimeout(()=>{
								uni.navigateBack()
							},2000)
						}).catch(err=>{
							
						})
					} else {
						console.log('验证失败');
					}
				});
				
				
			}
		}
	}
</script>
<style lang="scss">
	page {

		/* #ifdef MP-WEIXIN */
		height: 100%;
		/* #endif */
		background-color: #fff;
	}

	.textPz {
		background-color: #F8F8F8;
		border-radius: 20rpx;
	}

	.wrapForm {
		background: #fff;

		.u-list-item {
			background-color: #F8F8F8 !important;
		}
	}
</style>
<style lang="scss" scoped>
	.wrapForm {

		height: 100%;

		.wrapFormBody {
			margin-top: -30rpx;
			border-radius: 40rpx 40rpx 0 0;
			background: #fff;
		}


	}

	.bgLine {
		background-color: #E1EEFF;
		width: 100%;
		height: 60rpx;
	}

	.bottomW {
		position: fixed;
		bottom: 40rpx;
		width: 100%;
		left: 0;
	}

	.rightNowPay {
		width: 670rpx;
		height: 100rpx;
		line-height: 100rpx;
		background: #3291F8;
		border-radius: 30rpx;

	}
</style>